package c.c.b.a.b.a.i;

import c.c.b.a.b.a.k.a;
import c.c.b.a.b.a.k.b;
import c.c.b.a.b.a.k.c;
import c.c.b.a.b.a.k.f;
import c.c.b.a.b.a0;
import c.c.b.a.b.z;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;

/* compiled from: Platform */
public class e {
    public static final e a;
    public static final Logger b = Logger.getLogger(z.class.getName());

    /* JADX WARNING: Missing exception handler attribute for start block: B:4:0x000d */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Can't wrap try/catch for region: R(2:4|5) */
    /* JADX WARNING: Missing block: B:5:?, code skipped:
            r4 = java.lang.Class.forName("org.apache.harmony.xnet.provider.jsse.SSLParametersImpl");
     */
    /* JADX WARNING: Missing block: B:18:0x0061, code skipped:
            r0 = null;
     */
    static {
        /*
        r0 = byte[].class;
        r1 = 0;
        r2 = 1;
        r3 = 0;
        r4 = "com.android.org.conscrypt.SSLParametersImpl";
        r4 = java.lang.Class.forName(r4);	 Catch:{ ClassNotFoundException -> 0x000d }
    L_0x000b:
        r6 = r4;
        goto L_0x0014;
    L_0x000d:
        r4 = "org.apache.harmony.xnet.provider.jsse.SSLParametersImpl";
        r4 = java.lang.Class.forName(r4);	 Catch:{ ClassNotFoundException -> 0x0061 }
        goto L_0x000b;
    L_0x0014:
        r7 = new c.c.b.a.b.a.i.d;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r4 = "setUseSessionTickets";
        r5 = new java.lang.Class[r2];	 Catch:{ ClassNotFoundException -> 0x0061 }
        r8 = java.lang.Boolean.TYPE;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5[r3] = r8;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r7.m920init(r1, r4, r5);	 Catch:{ ClassNotFoundException -> 0x0061 }
        r8 = new c.c.b.a.b.a.i.d;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r4 = "setHostname";
        r5 = new java.lang.Class[r2];	 Catch:{ ClassNotFoundException -> 0x0061 }
        r9 = java.lang.String.class;
        r5[r3] = r9;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r8.m920init(r1, r4, r5);	 Catch:{ ClassNotFoundException -> 0x0061 }
        r4 = "GMSCore_OpenSSL";
        r4 = java.security.Security.getProvider(r4);	 Catch:{ ClassNotFoundException -> 0x0061 }
        if (r4 == 0) goto L_0x0037;
    L_0x0036:
        goto L_0x003c;
    L_0x0037:
        r4 = "android.net.Network";
        java.lang.Class.forName(r4);	 Catch:{ ClassNotFoundException -> 0x003e }
    L_0x003c:
        r4 = 1;
        goto L_0x003f;
    L_0x003e:
        r4 = 0;
    L_0x003f:
        if (r4 == 0) goto L_0x0058;
    L_0x0041:
        r4 = new c.c.b.a.b.a.i.d;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5 = "getAlpnSelectedProtocol";
        r9 = new java.lang.Class[r3];	 Catch:{ ClassNotFoundException -> 0x0061 }
        r4.m920init(r0, r5, r9);	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5 = new c.c.b.a.b.a.i.d;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r9 = "setAlpnProtocols";
        r10 = new java.lang.Class[r2];	 Catch:{ ClassNotFoundException -> 0x0061 }
        r10[r3] = r0;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5.m920init(r1, r9, r10);	 Catch:{ ClassNotFoundException -> 0x0061 }
        r9 = r4;
        r10 = r5;
        goto L_0x005a;
    L_0x0058:
        r9 = r1;
        r10 = r9;
    L_0x005a:
        r0 = new c.c.b.a.b.a.i.a;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5 = r0;
        r5.m5327init(r6, r7, r8, r9, r10);	 Catch:{ ClassNotFoundException -> 0x0061 }
        goto L_0x0062;
    L_0x0061:
        r0 = r1;
    L_0x0062:
        if (r0 == 0) goto L_0x0066;
    L_0x0064:
        goto L_0x00da;
    L_0x0066:
        r0 = javax.net.ssl.SSLParameters.class;
        r4 = "setApplicationProtocols";
        r5 = new java.lang.Class[r2];	 Catch:{ NoSuchMethodException -> 0x0085 }
        r6 = java.lang.String[].class;
        r5[r3] = r6;	 Catch:{ NoSuchMethodException -> 0x0085 }
        r0 = r0.getMethod(r4, r5);	 Catch:{ NoSuchMethodException -> 0x0085 }
        r4 = javax.net.ssl.SSLSocket.class;
        r5 = "getApplicationProtocol";
        r6 = new java.lang.Class[r3];	 Catch:{ NoSuchMethodException -> 0x0085 }
        r4 = r4.getMethod(r5, r6);	 Catch:{ NoSuchMethodException -> 0x0085 }
        r5 = new c.c.b.a.b.a.i.b;	 Catch:{ NoSuchMethodException -> 0x0085 }
        r5.m5328init(r0, r4);	 Catch:{ NoSuchMethodException -> 0x0085 }
        r0 = r5;
        goto L_0x0086;
    L_0x0085:
        r0 = r1;
    L_0x0086:
        if (r0 == 0) goto L_0x0089;
    L_0x0088:
        goto L_0x00da;
    L_0x0089:
        r0 = "org.eclipse.jetty.alpn.ALPN";
        r0 = java.lang.Class.forName(r0);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r4 = "org.eclipse.jetty.alpn.ALPN$Provider";
        r4 = java.lang.Class.forName(r4);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r5 = "org.eclipse.jetty.alpn.ALPN$ClientProvider";
        r10 = java.lang.Class.forName(r5);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r5 = "org.eclipse.jetty.alpn.ALPN$ServerProvider";
        r11 = java.lang.Class.forName(r5);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r5 = "put";
        r6 = 2;
        r6 = new java.lang.Class[r6];	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r7 = javax.net.ssl.SSLSocket.class;
        r6[r3] = r7;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r6[r2] = r4;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r7 = r0.getMethod(r5, r6);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r4 = "get";
        r5 = new java.lang.Class[r2];	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r6 = javax.net.ssl.SSLSocket.class;
        r5[r3] = r6;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r8 = r0.getMethod(r4, r5);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r4 = "remove";
        r2 = new java.lang.Class[r2];	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r5 = javax.net.ssl.SSLSocket.class;
        r2[r3] = r5;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r9 = r0.getMethod(r4, r2);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r0 = new c.c.b.a.b.a.i.c;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r6 = r0;
        r6.m5329init(r7, r8, r9, r10, r11);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00d0, ClassNotFoundException | NoSuchMethodException -> 0x00d0 }
        r1 = r0;
        goto L_0x00d1;
    L_0x00d1:
        if (r1 == 0) goto L_0x00d5;
    L_0x00d3:
        r0 = r1;
        goto L_0x00da;
    L_0x00d5:
        r0 = new c.c.b.a.b.a.i.e;
        r0.m922init();
    L_0x00da:
        a = r0;
        r0 = c.c.b.a.b.z.class;
        r0 = r0.getName();
        r0 = java.util.logging.Logger.getLogger(r0);
        b = r0;
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.c.b.a.b.a.i.e.m921clinit():void");
    }

    public static <T> T b(Object obj, Class<T> cls, String str) {
        Class cls2 = Object.class;
        Class cls3 = obj.getClass();
        while (cls3 != cls2) {
            try {
                Field declaredField = cls3.getDeclaredField(str);
                declaredField.setAccessible(true);
                Object obj2 = declaredField.get(obj);
                if (obj2 != null) {
                    if (cls.isInstance(obj2)) {
                        return cls.cast(obj2);
                    }
                }
                return null;
            } catch (NoSuchFieldException unused) {
                cls3 = cls3.getSuperclass();
            } catch (IllegalAccessException unused2) {
                throw new AssertionError();
            }
        }
        String str2 = "delegate";
        if (!str.equals(str2)) {
            obj = b(obj, cls2, str2);
            if (obj != null) {
                return b(obj, cls, str);
            }
        }
        return null;
    }

    public static List<String> e(List<a0> list) {
        ArrayList arrayList = new ArrayList(list.size());
        int size = list.size();
        for (int i = 0; i < size; i++) {
            a0 a0Var = (a0) list.get(i);
            if (a0Var != a0.HTTP_1_0) {
                arrayList.add(a0Var.a);
            }
        }
        return arrayList;
    }

    public c a(X509TrustManager x509TrustManager) {
        return new a(k(x509TrustManager));
    }

    public Object c(String str) {
        return b.isLoggable(Level.FINE) ? new Throwable(str) : null;
    }

    public String d(SSLSocket sSLSocket) {
        return null;
    }

    public X509TrustManager f(SSLSocketFactory sSLSocketFactory) {
        try {
            Object b = b(sSLSocketFactory, Class.forName("sun.security.ssl.SSLContextImpl"), "context");
            if (b == null) {
                return null;
            }
            return (X509TrustManager) b(b, X509TrustManager.class, "trustManager");
        } catch (ClassNotFoundException unused) {
            return null;
        }
    }

    public void g(int i, String str, Throwable th) {
        b.log(i == 5 ? Level.WARNING : Level.INFO, str, th);
    }

    public void h(String str, Object obj) {
        if (obj == null) {
            str = c.b.a.a.a.D(str, " To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);");
        }
        g(5, str, (Throwable) obj);
    }

    public void i(Socket socket, InetSocketAddress inetSocketAddress, int i) throws IOException {
        socket.connect(inetSocketAddress, i);
    }

    public void j(SSLSocket sSLSocket, String str, List<a0> list) {
    }

    public f k(X509TrustManager x509TrustManager) {
        return new b(x509TrustManager.getAcceptedIssuers());
    }

    public void l(SSLSocket sSLSocket) {
    }

    public boolean m(String str) {
        return true;
    }
}
